﻿using System.Collections.Generic;
using System.ComponentModel;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using SX.BaseService.API.Base;
using SX.BaseService.Service.Implement.SysRole;
using SX.BaseService.Service.Interface;
using SX.Core;

namespace SX.BaseService.API
{
   
    [Description("角色管理")]
    [Menu]
    public class SysRoleController : BaseController
    {
        private readonly ISysRoleService _service;
        public SysRoleController(ISysRoleService sysRoleService)
        {
            _service = sysRoleService;
        }

        [Description("查询")]
        [HttpGet]
        public async Task<IApiResult> Query([FromQuery] RoleQueryModel model)
        {
            return await _service.Query(model);
        }
        
        [HttpPost]
        [Description("添加")]
        public async Task<IApiResult> Add([FromBody] RoleAddModel model)
        {
            return await _service.Add(model);
        }
      
        [HttpPost]
        [Description("删除")]
        public async Task<IApiResult> Delete([FromBody]List<string> ids)
        {
            return await _service.Delete(ids);
        }
        
        [HttpPost]
        [Description("更新")]
        public async Task<IApiResult> Update([FromBody]RoleUpdateModel model)
        {
            return await _service.Update(model);
        }
        
        [HttpGet]
        [Description("详情")]
        public async Task<IApiResult> Get([FromQuery] string id)
        {
            return await _service.GetById(id);
        }

    }
}